# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=ares
pkgver=0.11.0.r272.g56772ac
pkgrel=1
pkgdesc='Automated decoding of encrypted text without knowing the key or ciphers used.'
arch=('x86_64' 'aarch64')
groups=('blackarch' 'blackarch-cracker' 'blackarch-crypto')
url='https://github.com/bee-san/ares'
license=('MIT')
depends=()
makedepends=('git' 'cargo')
source=("git+https://github.com/bee-san/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  ( set -o pipefail
    git describe --long --tags --abbrev=7 2>/dev/null |
      sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
    printf "%s.%s" "$(git rev-list --count HEAD)" \
      "$(git rev-parse --short=7 HEAD)"
  )
}

build() {
  cd $pkgname

  cargo build --release --locked
}

package() {
  cd $pkgname

  install -Dm 755 "target/release/$pkgname" "$pkgdir/usr/bin/$pkgname"
  install -Dm 644 README.md -t "$pkgdir/usr/share/doc/$pkgname"

  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

